import React, { Component } from 'react'
import PropTypes from 'prop-types'
import TodoItem from './TodoItem'

export default class Content extends Component{
    static propTypes = {
        todos: PropTypes.array.isRequired,
        actions: PropTypes.object.isRequired,
    }

    render() {
        const actions = this.props.actions
        const todoList = this.props.todos.map((todo) =>
            <TodoItem todo={todo} editTodo={actions.editTodo} deleteTodo={actions.deleteTodo} completeTodo={actions.completeTodo} key={todo.id}/>
        );
        return (
            <div className="todo-list">{todoList}</div>
        );
    }
}
